package flextestng.testing.model
{
	import flash.utils.Dictionary;
	
	public class TestDefinition
	{
		private var _parameters:Dictionary = new Dictionary();
		
		public function TestDefinition(name:String, suite:SuiteDefinition)
		{
			_name = name;
			_suite = suite;
		}
		
		public function addExcludeGroup(group:String):Boolean
		{
			if (_excludedGroups.indexOf(group) == -1) {
				_excludedGroups.push(group);
				return true;
			}
			
			return false;
		}
		
		public function addIncludeGroup(group:String):Boolean
		{
			if (_includedGroups.indexOf(group) == -1) {
				_includedGroups.push(group);
				return true;
			}
			
			return false;
		}
		
		public function addParameter(key:String, value:String):void
		{
			_parameters[key] = value;
		}
		
		public function addTestClass(testClass:ClassDefinition):Boolean
		{
			if (_classes.indexOf(testClass) == -1) {
				_classes.push(testClass);
				return true;
			}
			
			return false;
		}
		
		public function getParameter(key:String):String
		{
			var value:String = _parameters[key];
			
			if (value == null) {
				return suite.getParameter(key);
			}
			
			return value;
		}
		
		private var _classes:Array = [];
		public function get classes():Array
		{
			return _classes.slice();
		}
		
		private var _excludedGroups:Array = [];
		public function get excludedGroups():Array
		{
			return _excludedGroups.slice();
		}
		
		private var _includedGroups:Array = [];
		public function get includedGroups():Array
		{
			return _includedGroups.slice();
		}
		
		private var _name:String;
		public function get name():String
		{
			return _name;
		}
		
		private var _suite:SuiteDefinition;
		public function get suite():SuiteDefinition
		{
			return _suite;
		}
	}
}